{% set pypi_name = 'networking-generic-switch' %}
{% set source = fetch_source('https://tarballs.openstack.org/networking-generic-switch/networking-generic-switch-master.tar.gz') %}
{% set upstream_version = upstream_version() %}
{% set rpm_release = '0' %}
Name:           {{ py2name(py_versions='py3') }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        Generic Switch ML2 Neutron Driver
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/{{ pypi_name }}
Source0:      	{{ source|basename }}
BuildRequires:  fdupes
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('netmiko') }}
BuildRequires:  python3-neutron
BuildRequires:  {{ py3('neutron-lib') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.db') }}
BuildRequires:  {{ py3('oslo.i18n') }}
BuildRequires:  {{ py3('oslo.log') }}
BuildRequires:  {{ py3('oslo.middleware') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('six') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('stevedore') }}
BuildRequires:  {{ py3('tenacity') }}
BuildRequires:  {{ py3('testresources') }}
BuildRequires:  {{ py3('testtools') }}
BuildRequires:  {{ py3('tooz') }}
Requires: {{ py3('netmiko') }}
Requires: python3-neutron
Requires: {{ py3('oslo.config') }}
Requires: {{ py3('oslo.db') }}
Requires: {{ py3('oslo.i18n') }}
Requires: {{ py3('oslo.log') }}
Requires: {{ py3('oslo.middleware') }}
Requires: {{ py3('six') }}
Requires: {{ py3('stevedore') }}
Requires: {{ py3('tenacity') }}
Requires: {{ py3('tooz') }}
BuildArch:      noarch

%description
This is a Modular Layer 2 `Neutron Mechanism driver
<https://wiki.openstack.org/wiki/Neutron/ML2>`_. The mechanism driver is
responsible for applying configuration information to hardware equipment.
``GenericSwitch`` provides a pluggable framework to implement
functionality required for use-cases like OpenStack Ironic multi-tenancy mode.
It abstracts applying changes to all switches managed by this ML2 plugin
and handling ``local_link_information`` field of Neutron port.

%package doc
Summary:        Generic Switch ML2 Neutron Driver Doc
Group:          Documentation/HTML
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description doc
Documentation for OpenStack Generic Switch ML2 Neutron Driver.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{upstream_version}}
%py_req_cleanup

%build
%{py3_build}

PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}
%fdupes %{buildroot}%{python3_sitelib}

%check
%{__python3} -m stestr.cli run

%files
%license LICENSE
%doc README.rst
%{python3_sitelib}/networking_generic_switch
%{python3_sitelib}/networking_generic_switch*egg-info

%files doc
%license LICENSE
%doc doc/build/html

%changelog
